package com.jml.config;

import com.MyInterceptor;
import java.util.Arrays;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class ServiceAspect { //此时定义业务层的拦截处理
	private Logger log= LoggerFactory.getLogger(MyInterceptor.class);
	//aop   切入路径环绕通知
	@Around("execution(* com.jml..service..*.*(..))")
	public Object arroundInvoke(ProceedingJoinPoint point) throws Throwable{
		//打印参数
		log.info("**********service-before 执行参数:"+Arrays.toString(point.getArgs()));
		//进行核心业务的调用
		Object obj = point.proceed(point.getArgs());
		//返回结果
		log.info("**********service-after 返回结果:"+obj);
		return obj;
	}

}
